package cn.changhong.user.service;


import cn.changhong.user.aop.ResultBean;
import cn.changhong.user.exception.EmailAlreadyExists;
import cn.changhong.user.model.User;
import cn.changhong.user.model.vo.ListUserVO;
import cn.changhong.user.model.vo.UserVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @Author zz
 * @Date
 **/
public interface UserService {
    /**
     * 登录接口
     *
     * @param email
     * @param password
     * @return
     */
    User login(String email, String password);


    /**
     * 注册
     * @param email
     * @param password
     * @return
     * @throws Exception
     */
    ResultBean register(String email,String password) ;

    /**
     * 分页查询
     * @param currentPage
     * @param pageSize
     * @return
     */
    ResultBean<ListUserVO> listUserByPage(int currentPage, int pageSize);

    /**
     * 删除用户
     * @param email
     * @return
     */
    int removeUser(String email);

    /**
     * 冻结用户
     * @param email
     * @return
     */
    int freezeUser(String email);

    /**
     * 重置密码
     * @param password
     * @param userId
     * @return
     */
    int resetPassword(Long userId,String password);

    /**
     * 忘记密码
     * @param email
     * @return
     */
    ResultBean forgetPassword(String email);

    /**
     * 获取用户的信息
     * @param request
     * @return
     */
    UserVO getUser(HttpServletRequest request);

    /**
     * 添加用户，管理员有效
     * @param email
     * @param roleId
     * @return
     */
    ResultBean addUser(String email,int roleId);

    /**
     * 修改密码
     * @param request
     * @param oldPassword
     * @param newPassword
     * @param confirmPassword
     * @return
     */
    ResultBean updatePassword(HttpServletRequest request, String oldPassword, String newPassword, String confirmPassword);


}
